define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'knscy.order_ticket/index',
        add_url: 'knscy.order_ticket/add',
        edit_url: 'knscy.order_ticket/edit',
        delete_url: 'knscy.order_ticket/delete',
        export_url: 'knscy.order_ticket/export',
        modify_url: 'knscy.order_ticket/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh' ,'delete','export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id'},
                    {field: 'order_no', title: '订单NO',minWidth:180},
                    {field: 'ticket_type', title: '类型',search:'select' ,selectList: $nodes.ticketTypeList},
                    {field: 'ticket_id', title: '门票ID',minWidth:100},
                    {field: 'ticket_title', title: '标题',minWidth:180},
                    {field: 'ticket_subtitle', title: '副标题',minWidth:180},
                    {field: 'select_day', title: '出游时间',minWidth:180},
                    {field: 'buy_num', title: '购买数量',minWidth:100,search:false},
                    {field: 'price', title: '单价',minWidth:100,search:false},
                    {field: 'good_id', title: '商品ID',minWidth:100},
                   // {field: 'order_id', title: '订单ID',minWidth:100},

                    // {field: 'ticket_json', title: '门票数据'},
                    {field: 'people_json', title: '出行人数据', minWidth: 200,templet: function (d) {
                            return d.people_json.length ? '<span class="badge badge">'
                                + d.people_json[0].first_name+ d.people_json[0].name + d.people_json[0].mobile
                                + '</span>':'';
                        }},
                    // {field: 'sort', title: '排序', edit: 'text'},
                    {field: 'status', search: 'select', selectList: ["禁用","启用"], title: '状态', templet: ea.table.switch},
                    {field: 'create_time', title: '购买时间',minWidth:180,search:"range"},
                    {fixed:"right",width: 150, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});